#include "process.h"

const char *str="|/-\\";
void process1()
{
   char bar[100]={0};
   int size=0;
   int num=strlen(str);
   while(size<=100)
   {
       printf("[%-100s][%d%%][%c]\r",bar,size,str[size%num]);
       fflush(stdout);
       usleep(100000);
       bar[size++]='*';
       
   }
   printf("\n");
}

void process2(int rate)
{
  static char bar[100]={0};
  static int cnt=0;
   int num=strlen(str);
   if(rate<=100)
   {
       cnt++;
       cnt=(cnt>=num?0:cnt);
       printf("[%-100s][%d%%][%c]\r",bar,rate,str[cnt]);
       fflush(stdout);
       
       bar[rate]='#';
       
   }

}
